package lesson09;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Scanner;

public class Test01 {
    public void a() throws FileNotFoundException{
        System.out.println("进入方法a");
        b();
        System.out.println("退出方法a");
    }
    public void b() throws FileNotFoundException{
        System.out.println("进入方法b");
        c();
        System.out.println("退出方法b");
    }
    public void c() throws FileNotFoundException{
        System.out.println("进入方法c");
        try{
            d();
        }catch (LovoException e){
            System.out.println(e.getName() + " " + e.getCode());
        }

        System.out.println("退出方法c");
    }
    public void d() throws LovoException {
        Scanner sc = new Scanner(System.in);
        System.out.println("进入方法d");
       /* try{
            String str = "null";
            System.out.println(str.length());
            int a = 100/1;
            int input = sc.nextInt();
            return;
        }catch(NullPointerException e){
            System.out.println("引发空指针异常：" + e.getMessage());
            e.printStackTrace();
        }catch(ArithmeticException e){
            System.out.println("引发除0异常：" + e.getMessage());
        }catch(Exception e){
            System.out.println("未知异常：" + e.getMessage());
            return;
        }finally {
            System.out.println("最终执行的语句块");
        }*/
        try {
            FileInputStream fis = new FileInputStream("1.txt");
        } catch (FileNotFoundException e) {
            throw new LovoException("文件不存在",1001);
        }


//        System.out.println("退出方法d");
    }
    public static void main(String[] args) {
        Test01 test01 = new Test01();
        try {
            test01.a();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }

        // 问：final、finally、finalize三者的区别
    }
}
